﻿using behaviors.Behaviors;
using behaviors.Controllers;
using FubuMVC.Core;
using FubuMVC.Spark;

namespace behaviors
{
    public class BehaviorsRegistry
        : FubuRegistry
    {
        public BehaviorsRegistry()
        {
            IncludeDiagnostics(true);

            Actions
                .IncludeClassesSuffixedWithController();

            Routes
                .IgnoreControllerNamespaceEntirely()
                .HomeIs<HomeInputModel>();

            Views
                .TryToAttachWithDefaultConventions();
            
            this.UseSpark();

            Policies
                .WrapBehaviorChainsWith<SimpleBehavior>()
                .ConditionallyWrapBehaviorChainsWith<SystemTransactionBehavior>(call => call.HasAttribute<UseTransactionAttribute>());

            ApplyConvention<AppendFooterTextWhereAppropiate>();

        }
    }
}